<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
  	<link rel="stylesheet"
			href="${pageContext.request.contextPath}/css/base.css" />
		<link rel="stylesheet"
			href="${pageContext.request.contextPath}/css/info-reg.css" />
    <title>云云论坛-主贴</title>
    
    <style type="text/css">
    .topicdiv{    	
      	 width:80%;
      	 margin: 0px auto;
      }
      td{
      font-size: 15px;
      text-align: center;
      }
     body{
	 background-image: url(${pageContext.request.contextPath}/images/forum4.jpg);
	}
	
    </style>
  </head>
  <script type="text/javascript">
   window.onload=function(){
                //写入
                var oneInner = document.getElementById("div_id");
                oneInner.setAttribute("style","position:absolute;left:200px;top:100px;width:100px;height:100px;cursor:pointer;");
                var oneButton = document.createElement("input");
                oneButton.setAttribute("type","button");
                oneButton.setAttribute("value","x");
                if (oneButton.style.cssFloat)
                {
                    oneButton.style.cssFloat="right"
                }
                else
                {oneButton.style.styleFloat="right"}
                oneInner.appendChild(oneButton);
                document.body.appendChild(oneInner);
                //定时器
                var a1a = setInterval(moves,100);
                //函数
                var x = 10;
                var y = 10;
                function moves(){
                    var tops = oneInner.offsetTop
                    var lefts = oneInner.offsetLeft

                    if (lefts>=document.documentElement.clientWidth-oneInner.offsetWidth||lefts<=0)
                    {
                        x=-x
                    }

                    if (tops>=document.documentElement.clientHeight-oneInner.offsetHeight||tops<=0)
                    {
                        y=-y
                    }
                    tops+=y;
                    lefts+=x;
                    oneInner.style.top=tops+"px"
                    oneInner.style.left=lefts+"px"
                }
                //悬停停止
                oneInner.onmouseover=function(){
                    clearInterval(a1a);
                }
                //放手继续运动
                oneInner.onmouseout=function(){
                    a1a =setInterval(moves,100);
                }
                //删除
                oneButton.onclick=function(){
                    document.body.removeChild(oneInner);
                }
            }
  
  	var oldColor;
	function choice(trObj) {
		oldColor = trObj.bgColor;
		trObj.bgColor = "yellow";
	}
	function leave(trObj) {
		trObj.bgColor = oldColor;
	}
  


  </script>
  <body style="overflow: hidden">
  <div id="div_id" class="show">
    <img src="${pageContext.request.contextPath}/images/forum8.gif">
  </div>
  
  <input type="hidden" id="userName_id" value="${login_User.userName }"/>
		<div class="title">
			<h2 align="center">
				热门主贴浏览
			</h2>
		</div>
		
		<div class="main" align="center">
			<div style="height: 300px;">
				<table width="100%" align="center" cellspacing="0" cellpadding="0">
					<tr bgcolor="#e8c597">
						 <td width="15%">主题</td>
				       	  <td>内容</td>
				       	  <td width="15%">发帖时间</td>
				       	  <td width="15%">最后回复时间</td>
				       	  <td width="5%">回帖数</td>
				       	  <td >表情</td>
				       	  <td width="10%">发帖人</td>
						
					</tr>
					<c:forEach items="${requestScope.topicpage}" var="forum"
						varStatus="c">
						<tr 
							onmouseover=choice(this); onmouseout=leave(this);>
							<td>
							 <a href="${pageContext.request.contextPath}/ForumManager.action?method=queryById&id=+${forum.topicId}">
								${forum.tTopic}</a>
							</td>
							<td>
								${forum.tContents }
							</td>
							<td>
								${forum.tTime }
							</td>
							<td>
								${forum.lastReply }
							</td>
							<td>${forum.treplyCount }</td>
							<td> <img src="${pageContext.request.contextPath}/images/${forum.face}"></td>
							<td >
								${forum.userName }
							</td>			
						</tr>
						
					</c:forEach>
				</table>
			</div>
			
		</div>

   
  </body>
</html>
